/*
  该文件专门为Count组件生成action对象
*/

import {INCREMENT, DECREMENT} from './constant'

// 同步action 返回的一般对象
export const createIncrement = data =>({type: INCREMENT,data})
export const createDecrement = data => ({type: DECREMENT,data})

// 异步action 返回的是函数， 异步action中一般都会调用同步action
export const createAsyncIncrement = (data, time) => {
  return (dispatch)=>{
    setTimeout(() => {
      dispatch(createIncrement(data))
    }, time);
  }
}


